<template>
  <div class="words">
    <div class="title">
      {{ title }}
    </div>
    <div class="content">
      <ul v-if="words && words.length" class="word">
        <li @click="operator(item)" v-for="(item, i) of words" :key="i">
          {{ item }}
        </li>
      </ul>
      <div class="word" v-else>暂无内容</div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    title: String,
    words: Array
  },
  methods: {
    operator (msg) {
      this.$store.commit('updateSearchBar', msg)
      this.$store.dispatch('seachFromBar')
    }
  }
}
</script>
